<%@ page language="java" contentType="text/html; charset=UTF-8"    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="sec"    uri="http://www.springframework.org/security/tags"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<sec:authentication property="principal" var="currentPrincipal" scope="page" />

<fmt:setBundle basename="ApplicationMessage" />
<fmt:setLocale value="zh_CN" />

<!DOCTYPE html>
<html lang="zh-CN">
<head>

  <%@ include file="/WEB-INF/include/meta.jsp"%>
  <%@ include file="/WEB-INF/include/css.jsp"%>

</head>

<body class="ms-theme-blue">

  <%@ include file="/WEB-INF/include/header.jsp"%>
    
  <%@ include file="/WEB-INF/include/submenu.jsp"%>
  
  <div class="container-fluid ms-container has-ms-sidemenu">
    
    <ol class="ms-breadcrumb breadcrumb">
      <li class="active">角色管理&nbsp;&nbsp;-&nbsp;&nbsp;详情</li>
    </ol>
    
      <div class="ms-content-layout ">
      
          <div class="block-heading">
            <h5>基本信息</h5>
            
            <c:if test="${role.editable}">
	            <div class="pull-right" style="margin-top: 10px">
                <a href="${ctx.host}/roles/${role.id}/edit" data-target="#edit" data-toggle="modal">修改基本信息</a>&nbsp;&nbsp;
              </div>
            </c:if>
          </div>
          
          <div class="form-horizontal ms-form form-personal-info">
            <div class="form-group ms-form-group">
              <label class="control-label col-xs-2" style="width: 12%;">名称：</label>
              <div class="col-xs-2">
                <p class="form-control-static">${role.name}</p>
              </div>
              <label class="control-label col-xs-2" style="width: 12%;" >标识：</label>
              <div class="col-xs-2">
                <p class="form-control-static">${role.code}</p>
              </div>
            </div>
            
            <div class="form-group ms-form-group">
              <label class="control-label col-xs-2" style="width: 12%;">描述：</label>
              <div class="col-xs-2">
                <p class="form-control-static">${role.description}</p>
              </div>
              <label class="control-label col-xs-2" style="width: 12%;" >所属模板：</label>
              <div class="col-xs-2">
                <p class="form-control-static">${role.template.name}</p>
              </div>
            </div>
          </div>
           
          <div class="block-heading" style="margin-top: 30px;">
            <h5>权限范围</h5>
          </div>
          <table class="table table-hover ms-table">
            <thead>
                <tr>
                  <th>类型</th>
                  <th>名称</th>
                  <th>描述</th>
                </tr>
            </thead>
            <tbody>
                <c:forEach items="${resources}" var="resource">
                  <tr>
                    <td>${resource.type.description}</td>
                    <td>${resource.name}</td>
                    <td>${resource.description}</td>
                  </tr>
                </c:forEach>
            </tbody>
            <tfoot>
              <tr>
              <td colspan="3" class="no-vertical-padding">
                <div class="pull-left">
                  <jsp:include page="/WEB-INF/include/page.jsp">
                    <jsp:param name="url" value="${ctx.host}/roles/${role.id}" />
                    <jsp:param name="queryString" value="${queryString}" />
                  </jsp:include>
                </div>
                <div class="pull-right">
                </div>
              </td>
              </tr>
            </tfoot>
          </table>
        
        </div>
  </div>

  <%@ include file="/WEB-INF/include/script.jsp"%>
  <d:resource type="script" root="${ctx.resource}/build" src="js/page/authority/role-view.js"/>
   <script type="text/javascript">
       require(['page/authority/role-view'], function (page) {
           page.init()
       })
  </script>
  
</body>
</html>